#!/bin/sh
# - nr_task
# - samples
# - freq
# - test

## The FTQ benchmarks measure hardware and softwareinterference
## or 'noise' on a node from the applications perspective.

. $LKP_SRC/lib/upload.sh
. $LKP_SRC/lib/unit.sh
. $LKP_SRC/lib/reproduce-log.sh

[ "$test" = cache ] && {
	cache_size=$(sed -ne '1,$s/cache size\s\+:\s\([0-9]\+\)\s\+\(.\)./\1\2/p' /proc/cpuinfo | tail -n 1)
	cache_size_bytes=$(to_byte $cache_size)
	task_cache_size=$((cache_size_bytes/nr_task))
	opt_arg="-a $task_cache_size"
}

cd $BENCHMARK_ROOT/ftq || die "no $BENCHMARK_ROOT/ftq"

[ 0"$nr_task" -gt 1  ] && opt_task="-t $nr_task"

[ -n "$samples" ] || samples=10000

[ -n "$freq" ] && opt_freq="-f $freq"

samples=${samples%%ss}

log_cmd ./ftq_$test $opt_freq -n $samples $opt_task $opt_arg

upload_files -t results $BENCHMARK_ROOT/ftq/*.dat
